using System.Collections.Generic;
using System.Text;
using UnityEngine;

public static class WorldLog
{
    public static List<LLMClient.Message> log = new List<LLMClient.Message>();

    public static void Add(LLMClient.Message msg)
    {
        log.Add(msg);
    }

    public static string GetContext(int maxEntries = 20)
    {
        int start = Mathf.Max(0, log.Count - maxEntries);
        StringBuilder sb = new StringBuilder("Global context so far: ");
        for (int i = start; i < log.Count; i++)
        {
            sb.Append(log[i].role).Append(": ").Append(log[i].content).Append(" | ");
        }
        return sb.ToString();
    }

}
